using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyHealth : MonoBehaviour
{
    public float health;
    RagdollManager ragdolManager;
    [HideInInspector] public bool isDead;
    private void Start()
    {
        ragdolManager = GetComponent<RagdollManager>();
    
    }


    public void TakeDamage(float damage)
    {

        if (health > 0)
        {
            health -= damage;
            if (health <= 0) EnemyDeath();
            else Debug.Log("Hit");
        }

    }

    void EnemyDeath()
    {
        ragdolManager.TriggerRagdoll();
        Debug.Log("Death");
    }
}
